package com.dongwu.manager.dao;

import com.dongwu.common.dao.BaseDao;
import com.dongwu.manager.entity.Product;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface ProductDao  extends BaseDao<Product, String> {
	@Query(value="select * from product where goodsid =?1 and userid = ?2", nativeQuery=true)//原生sql语句
	Product getByUserAndGoodsid(String goodsid, String userid);
	
	@Query(value="select count(*) from product where userid = ?1", nativeQuery=true)//原生sql语句
	public Long countByUserid(String userid);
	
	@Query(value="SELECT * FROM product where id in (SELECT productid from device_product_record where deviceid = ?1) AND ads_classify_id = ?2", nativeQuery=true)//原生sql语句
	public List<Product> getProductForDevId(String deviceId,String classifyId);

	
}
